package br.com.ps.bombertournament.game;

import java.util.Comparator;

/**
 * Responsible to order the game object in the list to be rendered
 * 
 * @author Rennan Stefan Boni - rennanboni@gmail.com
 */
public class Perpective2D implements Comparator<BaseGameObject> {

	@Override
	public int compare(BaseGameObject arg0, BaseGameObject arg1) {
		int result = 0;
		
		if (arg0.getY() > arg1.getY()) {
			result = -1;
		} else if (arg0.getY() == arg1.getY()) {
			if (arg0.getX() < arg1.getX()) {
				result = -1;
			} else {
				result = 1;
			}
		} else {
			result = 1;
		}
		
		return result;
	}

}
